package com.vip.file.model.entity.bucket;

import lombok.Getter;

/**
 *
 */
@Getter
public enum FileTypeEnum {

    /**
     * 定义一些文件类型
     */
    ROOT(0,0,"",""),
    IMG(1,1,"img","img"),
    IMG_JPG(11,2,"jpg","img\\jpg"),
    IMG_JPEG(12,2,"jpeg","img\\jpeg"),
    IMG_PNG(13,2,"png","img\\png"),
    IMG_GIF(14,2,"gif","img\\gif"),
    IMG_BMP(15,2,"bmp","img\\bmp"),
    IMG_SVG(16,2,"svg","img\\svg"),
    EXCEL(2,1,"excel","excel"),
    EXCEL_DOC(21,2,"doc","excel\\doc"),
    EXCEL_DOCX(22,2,"docx","excel\\docx"),
    EXCEL_DOCM(23,2,"docm","excel\\docm"),
    EXCEL_DOTX(24,2,"dotx","excel\\dotx"),
    EXCEL_DOTM(25,2,"dotm","excel\\dotm"),
    EXCEL_XLS(26,2,"xls","excel\\xls"),
    EXCEL_XLSX(27,2,"xlsx","excel\\xlsx"),
    EXCEL_XLSM(28,2,"xlsm","excel\\xlsm"),
    EXCEL_XLTX(29,2,"xltx","excel\\xltx"),
    EXCEL_XLTM(211,2,"xltm","excel\\xltm"),
    EXCEL_XLSB(212,2,"xlsb","excel\\xlsb"),
    EXCEL_XLAM(213,2,"xlam","excel\\xlam"),
    EXCEL_PPT(214,2,"ppt","excel\\ppt"),
    EXCEL_PPTX(215,2,"pptx","excel\\pptx"),
    EXCEL_PPTM(216,2,"pptm","excel\\pptm"),
    EXCEL_PPSX(217,2,"ppsx","excel\\ppsx"),
    EXCEL_PPSM(218,2,"ppsm","excel\\ppsm"),
    EXCEL_POTX(219,2,"potx","excel\\potx"),
    EXCEL_POTM(220,2,"potm","excel\\potm"),
    EXCEL_PPAM(221,2,"ppam","excel\\ppam"),
    VIDEO(3,1,"video","video"),
    VIDEO_MP4(31,2,"mp4","video\\mp4"),
    VIDEO_AVI(32,2,"avi","video\\avi"),
    VIDEO_MOV(33,2,"mov","video\\mov"),
    VIDEO_MKV(34,2,"mkv","video\\mkv"),

    TXT(4,1,"txt","txt"),
    TXT_XML(41,2,"xml","txt\\xml"),
    TXT_LOG(41,2,"log","txt\\log"),
    ZIP(5,1,"zip","zip"),
    ZIP_TAR_GZ(52,2,"gz","zip\\gz"),
    ZIP_TAR_XZ(53,2,"xz","zip\\xz"),
    ZIP_TAR_BZ2(54,2,"bz2","zip\\bz2"),
    OTHER(6,1,"other","other");



    FileTypeEnum(Integer fileCode,Integer bucketLevel,String typeName,String typePathName){
        this.fileCode = fileCode;
        this.bucketLevel = bucketLevel;
        this.typeName = typeName;
        this.typePathName = typePathName;
    }

    private Integer fileCode;

    private Integer bucketLevel;

    private String typeName;

    private String typePathName;

    public static FileTypeEnum getByTypePathName(String typePathName) {
        FileTypeEnum[] values = FileTypeEnum.values();
        for (FileTypeEnum dicNameEnum:values) {
            if (dicNameEnum.typePathName.equals(typePathName)){
                return dicNameEnum;
            }
        }
        return ROOT;
    }

    public static FileTypeEnum getByTypeName(String typeName) {
        FileTypeEnum[] values = FileTypeEnum.values();
        for (FileTypeEnum dicNameEnum:values) {
            if (dicNameEnum.typeName.equals(typeName)){
                return dicNameEnum;
            }
        }
        return OTHER;
    }

}
